package interview.huawei.training.P17;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        // char[] directions = {'A', 'D', 'W', 'S'};
        int x = 0, y = 0;
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] operations = str.split(";");
        a:for(String operation : operations) {
            // 校验操作是否合法
            if(operation.length() <= 1) continue;
            char direction = operation.charAt(0);
            if(!checkDirection(direction)) {
                continue;
            }
            int offset = 0;
            for(int i = 1; i < operation.length(); i++) {
                char digit = operation.charAt(i);
                if(digit >= '0' && digit <= '9') {
                    offset = offset * 10 + (digit - '0');
                } else {
                    continue a;
                }
            }
            if(direction == 'A') {
                x -= offset;
            } else if(direction == 'D') {
                x += offset;
            } else if(direction == 'W') {
                y += offset;
            } else if(direction == 'S')  {
                y -= offset;
            }
        }
        
        System.out.println("(" + x + "," + y + ")");
    }
    
    private static boolean checkDirection(char d) {
        return d == 'A' || d == 'D' || d == 'W' || d == 'S';
    }
}